package com.sbcb.mongodb.service;

import com.sbcb.mongodb.entity.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("springbootMongoDBService")
public class SpringbootMongoDBService {
    @Autowired
    private MongoTemplate mongoTemplate;

    public void saveAll(List<Order> orderList){
        mongoTemplate.insert(orderList,"sbcb_orders");
//        for(Order order: orderList) {
//            mongoTemplate.save(order,"sbcb_orders");
//        }
    }
}
